package 线程的状态;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-09-22
 * Time: 16:12
 */
public class ThreadDemo2 {
    //使用匿名内部类的方式创建线程
    public static void main(String[] args) {
        //使用匿名的Runnable实现类
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("我是run方法");
            }
        });
        //启动线程
        t1.start();

        Thread t2 = new Thread(){
            @Override
            public void run() {
                System.out.println("我是run方法");
            }
        };
        //创建线程
        t2.start();


    }
}
